package com.czd.support.service;

import com.czd.base.service.BaseService;
import com.czd.support.model.HandselHistory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 功能说明：充值历史表service
 * 作者：liuxing(2014-12-30 23:21)
 */
@Service
public class HandselHistoryService extends BaseService<HandselHistory> {
    @Autowired
    private AssetService assetService;

    @Transactional
    public int insertAndReturnId(int userId, String type, int amount,int adminId) {
        HandselHistory insertBean = new HandselHistory();
        insertBean.setUserId(userId);
        insertBean.setType(type);
        insertBean.setAmount(amount);
        insertBean.setCreator(adminId);
        insertBean.setBalance(amount);
        if(super.insert(sqlId("insertAndReturnId"), insertBean)){
            return insertBean.getId();
        }
        return 0;
    }
}
